﻿
using Lucy.Editor.Framework;

namespace Lucy.Editor.ViewModels
{
    class LucyEditorViewModel : ViewModel
    {
        public ViewModelCommand CloseCommand { get; private set; }
        public ViewModelCommand CreateProjectCommand { get; private set; }

        public LucyEditorViewModel()
        {
            CloseCommand = new ViewModelCommand(ViewService.CloseApplication);
            CreateProjectCommand = new ViewModelCommand(CreateProjectExecute);
        }

        private void CreateProjectExecute()
        {
            Project = new ProjectViewModel {Name = "Project 1"};
            Project.RootAssetTreeViewItem.CreateChild(new FolderTreeViewItemViewModel {Name = "Textures"});
            Project.RootProjectTreeViewItem.CreateChild(new FolderTreeViewItemViewModel {Name = "Scenes"});
            Project.OpenDocument(new SceneViewModel {Name = "SceneView"});
        }

        private ProjectViewModel _projectViewModel;
        public ProjectViewModel Project
        {
            get { return _projectViewModel; }
            set
            {
                if (_projectViewModel != value)
                {
                    _projectViewModel = value;
                    FirePropertyChanged("Project");
                }
            }
        }
    }
}
